package com.example.app.service;

import com.example.app.mapper.SPrivilegeUserMapper;
import com.example.util.model.PrivilegeUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

//@Configuration
@Service
@RestController
@RequestMapping("/service")
public class PrivilegeUserService {
	@Autowired
	private SPrivilegeUserMapper sPrivilegeUserMapper;
	
	@Cacheable(value="privilegeUser", key="'login_user'")
    @RequestMapping(value = "/loginName")
    public PrivilegeUser selectByPrimaryKey(String loginName) {
        System.out.println("开始查询.....");
        try {
            Thread.sleep(3 * 1000l);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("查询结束......");
        PrivilegeUser privilegeUser=sPrivilegeUserMapper.getCurrentUserByloginName(loginName);

        return privilegeUser;
    }
	
}
